1 using UnityEngine;
2 using
System.Collections;
3
4 [RequireComponent(
typeof(WheelCollider))]
5 public
class Wheel : MonoBehaviour {
6
7     WheelCollider wc;
8
9     
void Awake () {
10         wc = GetComponent<WheelCollider>();
11     }
12
13     
public void Move(float val)
14     {
15         wc.motorTorque = val;
16         wc.motorTorque *=
0.9f;
17     }
18
19     
public void Turn(float val)
20     {
21         wc.steerAngle = val;
22     }
23
24 }


Gõ tìm kiếm nhanh...